/***************************************************************************
 *   Copyright (C) 2007 by ludo   *
 *   ludo42fr@free.fr   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "QVlcInstance.h"
#include <QApplication>

QVlcInstance::QVlcInstance ( const QStringList &vlcOptions,QObject *parent )
		:QObject ( parent )
		,_vlcinstance ( 0 )
		,_exception ( this )
		,_input ( 0 )
		,_audio ( 0 )
{

  QStringList opt;
  opt<<QApplication::applicationName();
  opt<<vlcOptions;
  char **c_opt=(char**)malloc(sizeof(char*)*opt.size()); //paye ton code de mer**
  for (int i = 0; i < opt.size(); ++i)
    c_opt[i]=opt[i].toLocal8Bit().data();
  _vlcinstance=libvlc_new(opt.size(),c_opt,_exception.internalPointer());
  free (c_opt);
}

QVlcInstance::~QVlcInstance()
{
}


libvlc_instance_t * QVlcInstance::internalPointer()
{
	return _vlcinstance;
}
//QVlcVideo *video();
QVlcAudio *QVlcInstance::audio()
{
	return _audio;
}

QVlcInput *QVlcInstance::input()
{
	return _input;
}

